<?php

class User {
	
	private $id_user;
	private $mail;
	private $password;
	private $name;
	private $facebook_id;
	private $birthdate;
	private $status;
	private $time;
	
	public function __construct($map=array()){
		
		$this->id_user = isset($map['id_user']) ? $map['id_user'] : null;
		$this->mail = isset($map['mail']) ? $map['mail'] : null;
		$this->password = isset($map['password']) ? $map['password'] : null;
		$this->name = isset($map['name']) ? $map['name'] : null;
		$this->facebook_id = isset($map['facebook_id']) ? $map['facebook_id'] : null;
		$this->birthdate = isset($map['birthdate']) ? $map['birthdate'] : "0000-00-00";
		$this->status = isset($map['status']) ? $map['status'] : 0;
		$this->time = isset($map['time']) ? $map['time'] : 	date("Y-m-d H:i:s");
		
	}
		
	public function update($data){
		
		if (isset($data['mail']))
			$this->setMail($data['mail']);
		if (isset($data['password']))
			$this->setPassword($data['password']);
		if (isset($data['name']))
			$this->setName($data['name']);
		if (isset($data['facebook_id']))
			$this->setFacebookId($data['facebook_id']);
		if (isset($data['birthdate']))
			$this->setBirthDate($data['birthdate']);
		if (isset($data['status']))
			$this->setStatus($data['status']);
	}
	
	// Getter
	public function getIdUser(){
		return $this->id_user;
	}
	
	public function getMail(){
		return $this->mail;
	}
	
	public function getPassword(){
		return $this->password;
	}
	
	public function getName(){
		return $this->name;
	}
	
	public function getTime(){
		return $this->time;
	}
	
	public function getFacebookId(){
		return $this->facebook_id;
	}
	
	public function getBirthDate(){
		return $this->birthdate;
	}
	
	public function getStatus(){
		return $this->status;
	}
	
	// Setter
	public function setPassword($newpwd){
		$this->password = $newpwd;
	}
	
	public function setName($newName){
		$this->name = $newName;
	}
	
	public function setMail($newMail){
		$this->mail = $newMail;
	}
	
	public function setFacebookId($newFid){
		$this->facebook_id = $newFid;
	}
	
	public function setBirthDate($newbd){
		$this->birthdate = $newbd;
	}
	
	public function setStatus($newS){
		$this->status = $newS;
	}
	
	
	
}


?>